<?php

/** libraries
 * http://docs.joomla.org/JToolBarHelper
 */

/* No direct access to this file */
defined('_JEXEC') or die('Restricted access');

/* import Joomla view library */
jimport('joomla.application.component.view');

class bgViewbg extends JView
{
	/* Overwriting JView display method */
	function display($tpl = null) 
	{
       $model = $this->getModel();
       
       switch(JRequest::getVar('task')){
            case 'edit':
                JToolBarHelper::title( 'クラブ種別の更新', 'club.png' );
               
                JToolBarHelper::save('save','登録');
       	        JToolBarHelper::cancel('cancel', 'キャンセル');
                $this->setLayout('edit');
                
                break;
                
            case 'add':
            	JToolBarHelper::title( 'クラブ種別の追加', 'club.png' );
                
                JToolBarHelper::save('save','登録');
       	        JToolBarHelper::cancel('cancel', 'キャンセル');
                $this->setLayout('edit');
                
            	break;
            
            /* upload file csv */    
            case 'upload':
                /* if file csv not empty */
                if ($_FILES[csv][size] > 0)
                {  
                    //echo "<meta charset='UTF-8'/>";
                    /* read file csv, return array */
                    $this->list = HelperBG::readCSV($_FILES['csv']['tmp_name']); //ok doc file csv
                    $model->uploadCSV($this->list); //Hung bo => nho mo comment lai
                     /*echo "<meta charset='UTF-8' />";
                     echo '<pre>';
                     var_dump($this->list);
                     echo '</pre>';die;*/
                    //input date
                    //$model->update_ocba_20131025($this->list); 
                    //$model->update_ocba_rest($this->list);
                    //$model->update_ocba_pr($this->list);
                    //$model->uploadCSV_gymt($this->list); 
                    //$model->uploadCSV_pool($this->list); 
                    //$model->uploadCSV_dock($this->list); 
                    //$model->update_dock_date($this->list); 
                    //$model->uploadCSV_coli($this->list);
                    //$model->uploadCSV_term($this->list);
                    //model->uploadCSV_usce($this->list);
                    //$model->uploadCSV_user($this->list);
                    //$model->uploadCSV_group_user_map($this->list);
                    //$model->update_ocba_images($this->list);
                    //$model->uploadCSV_uscl($this->list);
                    //$model->uploadCSV_coch($this->list);
                    //$model->check_null_COCH_CODE($this->list);
                    //$model->uploadCSV_actt($this->list);
                     //$model->copy_ocba_images($this->list);
                    //$model->check_null_ACTT_CODE($this->list);
                    //$model->uploadCSV_town($this->list); 
                    //$model->uploadCSV_user($this->list);
                    //$model->uploadCSV_ocba($this->list);
                    //$model->update_actt_webf($this->list);
                    //$model->replace_KT_DB();
                    
                    $this->list['filter_search'] = &JRequest::getVar('filter_search');
                    $this->list['status'] = &JRequest::getVar('status');
                    $this->rows =& $model->getAll($this->list); 
                    $this->pagination =& $this->get('Pagination');
                    
                	JToolBarHelper::title( 'クラブ種別の一覧', 'club.png' );
        	        JToolBarHelper::deleteList('', 'remove','削除');
                    $this->setLayout('default');
       
                    break;
                }   
            /* default value */        
            default :
                $this->list['filter_search'] = &JRequest::getVar('filter_search');
                $this->list['status'] = &JRequest::getVar('status');
                $this->rows =& $model->getAll($this->list); 
                $this->pagination =& $this->get('Pagination');
                
            	JToolBarHelper::title( 'クラブ種別マスタ', 'club.png' );
    	        JToolBarHelper::deleteList('', 'remove','削除');
                $this->setLayout('default');        
		}
		parent::display();
	}
}




